package com.ce.server.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ce.server.pojo.ClockIn;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author 郑爽
 * @since 2021-11-17
 */
public interface ClockInMapper extends BaseMapper<ClockIn> {


  /**
   * 获取目前最大的打卡时间
   *
   * @return
   */
  LocalDateTime getMaxCreateTime();


  /**
   * 批量添加代打卡记录
   *
   * @param snos
   * @param begin
   * @return
   */
  int insertByBatchSno(List<String> snos, LocalDateTime begin);


  /**
   * 分页获取打卡信息
   *
   * @param page
   * @param clockIn
   * @return
   */
  IPage<ClockIn> getClockInByPage(@Param("page") Page<ClockIn> page, @Param("clockIn") ClockIn clockIn, @Param("createTimeScope") LocalDate[] createTimeScope);

  IPage<ClockIn> getClockInByPageAndClockIn(@Param("page") Page<ClockIn> page, boolean isTodayClockIn,
                                            LocalDateTime todayBegin,
                                            LocalDateTime todayEnd);


}
